safer handling of keyboard shortcuts