function validatePath modified