Fix crash on new document