Fix cutoff management and buffer overflow