Protect from errors when pressing backspace