fix time diff bug for write as well