Fixed https://issues.apache.org/jira/browse/DIRSERVER-1062. Fixed 1-2 more bugs while working on this one. It seems the implementation was done with misunderstood semantics.