several fixes to erase_data

Fixes multiple problems with \033[nJ, also fixes issues #46 and #55 from Google Code.