terminal cursor restore bug fixed