modified ScriptCollectorMethods.js to create head objects if they do not exist