Fixing issue with empty payloads not writing properly