Changed if and error by assert