fixed an issue with an assertion that failed because it was placed too early in the code.