fix of RavenDB-1700 (reapplied https://github.com/ayende/ravendb/pull/592)