fixed NPE in mode
Merge pull request #289 from fterrier/mode-hotfix

fixed NPE in mode