Added more nullchecks.