fixed a few bugs related to non-PATSHOME environments