minor bug fix.
fix a bug when only one switch exists