corrected insert method