Null document handle fix