Fix dirname creation