Fixed some major insertion bugs