Wrong class cast in WidgetResolver (fixes #667)