JS bug fixes for count update