replaced 'access' call for file existence check with portable fopen-based method