fix bug in insert