Fix js errors for switch selection