check_environment in main()
convert to version 3 with an unresolved hack