Set dirname properly