more database independent fixes