Logic error with pp