fixing uses of lastrowid