Fix bugs.

Fix exceptions according to current protocol.