Replaced assert comment with an if check.