Bug fixes. Support for ProxyResource. Better testcases.