NPE fix (Issue #26)