minor refactoring 'user_interface.rb'

Fix crash #2491