Added correct handling of backspace key