Added some CLI functions, fixed some RPC bugs