critical distance calculation fix

More often than not I was getting normal distances, but every now and then there were some squirrelly ones coming back.  I dug around a little and found `coordinates[0]` where it should have been `coordinates[1]`.  I do that all the time too!