add some tests, fixed autoincrement