Fixes some RPC and math bugs.