Fixed bugs found while testing Psi client