replace tempfile with mktemp for centos
fail fast - move pg_stat to begining
Merge pull request #28 from hughsaunders/master

use mktemp instead of tempfile, as mktemp not available on default centos.