remove database references in queries