Fixed some switch case bugs