adding models and test_db, fixing some errors in db and orm