added @piatra's fix to switch'