Fixed bug in insert method.