Fix keyboard handler and add Alert handler