added if before synctex init to the new loadDocument