replace unbox warning with an assertion

this code is fine and the warning is not needed.