fixes and avoid backup files in env
better error handling