Fixes a debug log and adds an assertion.