fixed bugs from db migration