Fixed a potentially crippling error that was causing it not to check for the goal state...