changed db schema to function correctly