fix null pointer exception (Bug report issue #806)