terminal resize handling fixes, p.1
terminal resize handling fixes, p.2 [it still segfaults somewhere]
caught the segfault