Fixed a bug where a file was being used incorrectly to return state from a subshell but was overwriting other changes.