protection against null pointer
minor mod