Fixed error encoding over RPC