Fix #478 assertion failure