This fixes an issue with dirty node passed to add_tail(). Thanks to Andreas Rammhold for the initial patch.