fixed the insert method