Bug/507 solve database structure problems