Merge fix to prevent creating empty files due to zero payload