fix assertion in WH::toByteArray