fix pstatus issue and add tests