Changed getpid() to stat(), to prevent glibc caching from interfering