Added fallback for getting the filename