Fixed problem with lastInsertId.