Fixed bug with db schema