change assertion to debug if the active document is null