fixed switch bugs