fixed bug in headless javascript enviroments, missing declaration of  and  on the internal  (jbergknoff)