[minor] Do not check for a variable twice.
improved error handling
improved error handling

in fixing the one I missed, I noticed that it's procedure in this codebase to emit asynchronously.