More bug fixing for switch