Fixed some typos and NULL vars