dirname function correction