Fixing issue when resizing terminal