better path validation