Fixed a major bug where a file was used to pass state between subshells but the actual state ws being overwritten with old data