Adds a check to restrictTo to verify the context of the call is valid. Addresses generic error reported in #87.