Fixed bug in pb switching