fixed bug in insert