fixed bug on toggling of javascript