Fixed null pointer deref