Fixed an error when trying to get the lastInsertId