Fix bug when using mode-name