Update insertEntry to correctly update/add new elements