updating switch logic bug