major bug getting last insert id. Fixed