Fixed errors in widget code