now uses expand_path for opening local files.