small update in insert funciton