It looks like we never hit this condition... possibly we should give different document as argument