Fixed the column offset in write_rows and write_columns