Fixed an error in the reachability code