Fixed write case for optional fields