solving problems with insert functions