Fixed bug where client ID was ignored; minor bug fixes in unit tests.