nullpointer fix - patch by Roger