Sync widget.php with smith version (including fix for issue #15)