more database fixes