fixed crash on long back press

The below change fixes the crash on long press on backspace key.