Fix bug in ppgen found by address sanitizer