Wrong class cast in WidgetResolver