fixed popup problem
fixed counting error