Fixed javascript bug