fixed a javascript bug