Fix bug in address sorting; updated fix for issue #37