Fixed bug in inserting items