Fixed sort with geo distance and arrays - closes #246