added precaution (after seeing NRE in tests)
minor fixes