fixed calculate path problem