added db schema
some minor changes and a quick fix