Fixed crashing when terminal resized