Safer handling of KVM ID lookup + fixes to mistakes found during testing (TUI-95)