Fix area sorting corner case (fixes #1903)