fixed bug in insert_before