fixed bug in Pimage