implement safe_call