some fixes for db