Fixed dodgy javascript