Fix issue where switching terminals didn't actually switch the correct terminal