Fixed and updated issues with database schema