Fix rpc thread and python shell

unit-tests