fixed some errors in database structure