fix issue with retrieving last insert id