fixed getMaxPosition() when no documents