More db orm fixes