Re-fix the path calculation