fixed up the insertion logic