Make the max loss an environment variable