This should be after keyup instead. Right now, the second I try to do anything, even click Shift, the error message appears.