Fix javascript bug