added more exception handling to file_exists