adding better handling of TEST_MODE constant not being set