I would have prefered a more gneneral solution (this is likely to happen in more cases), but fixes the actual problem.