Fixed switch bugs