improved terminal title handling