some fixes on database