fixed bugs in psf.py