Fixed a slight issue with an if tree