Fixed route bug in path detection