normalized some db functions