fix issue where pressing arrow key incurs too many callbacks