Fix bug with dirname.