Fixed exception handling in retrieveSwitch()