Fixed bugs in RestClientExtensions and added tests