Corrected insert() method