Fix NPE. Close #454.