Fix bug in Database.insert(T)

Fix bug that causes failure when inserting a row with auto-increment id