more database improvements