added sim mode
correct isNan error on distance