more correct path validation