Fixed #440: If there's a -R command line flag, store the passed filename in the state environment variable (unless it's set already).