fix intermittent erasing bug