Merge changes to pstj from upstream