added path length validation