Fixed parent directory logic