Corrected calculations src/pfgen.cpp

Corrected some errors pointed in issue #11, first noticed by @SomeAdrian