Implemented RavenDB-2716 and RavenDB-2717 issues