Fixed stack overflow and backspace not working