Fix some issues surrounding WITH_PAPI
Merge pull request #240 from bastih/master

Fix some issues surrounding WITH_PAPI