updated psi-new-history patch. Fixed small bug. Codestyle.