Fixed problem with the first time added widgets...

..and improved JS code for the rules form initialization.