allow script element in head and end of body

fixes #167

also fixed typo from #169