fixed bug in Widget constructor