remove the exception and use assert instead