Fix for doSwitch

Currently the doSwitch function only executes a single postRequest, meaning that at most 1 switch will be made. It looks like this bug was introduced due to commit 920bfa3c9ecb5996721476f2db7ff33977a61500.