Fix getDistance not detecting references in inactive cells properly