fixed bug in Pimage
Merge remote-tracking branch 'origin/master' into RegimeSwitch