Bug fix: assign errMsg value to config object instead of global scope