changed handling of javascript