Invert order of optional session arguments and environment variables