make sure refresh_count is incremented by only once at most for each repaint