javascript bug fixes