Fixed some bugs in pstat.c