Adding update script. Some related fixes.