Fix invalid memory access for debug assertion. See #446.