use internal assert
Removed unneeded code
explicit emit and throw failure