Correctly check for the first element in path