Fix a few RPC corner cases and add tests

There were just a few corner-cases about the place which could cause an internal server error when they should instead work.
Is this just trying to verify that whatever we've deserialised is safe to pass as kwargs?