add change func for switch