RavenDB-1195

http://issues.hibernatingrhinos.com/issue/RavenDB-1195

I saw you checked in a fix but there's a couple more changes needed.
I also updated the test to make sure it works.