Fixed regression in reopening documents introduced in previous commit