fix invalid dirname call