better error handling with config vars