fix last_insert_id check