Fix crashes when PAGER quits
Support different versions of Visual Studio