fixed the algorithm of handling erasing blocks