Fix encoding and filling in rows