changed assertion to an if statement