added SafeQuery