Fixing #3634 (wrong env in "cannot instantiate because not in its
scope" error message).