Fixed null pointer exceptions due to typos.