Fix the cursor bugs with ace and firebase