javascript bug fixed