fixed dirname bug