Fixed a typo and an if statement