Check (and canonicalize) dpid arguments to Switch()

This seems slightly ugly, but it has bitten many people.

Closes #268
Minor tweak of return value.