Bug fixes

Fixed bug with client crash.