corrections made to detect path