fixed tests and rpc main