Check if write is necessary