Fix a bug in retrieving the RS and plugin environment