Changed assert to an if statement