fixed some widget detection problems

Merge back to master