Need help to fix WordPress CPT Export to CSV

I have the attached php file from my theme which exports custom post types to CSV including custom fields (ACF). the problem i have is that if a cell is empty (contains no value) it inherits the value from the cell above it (see csv screenshot attached). So if no value in the meta field the cell should be empty. Need this fixed please!