Change switches to if. Catch error on getCfg