fix lots of bugs in separateJSFromHTMLFile which occured by last modification.