Fix NPE bug.
Merge branch 'dev'