Use isinstance for checking widget types

Hi,

when checking for widget types by class name, custom subclassed widgets aren't rendered properly. This approach is a bit more flexible.

Cheers,
Patrick