fixed bugs in the widget