Fixed NPE caused by previous commit. Issue #664