write offset bug fix

Was passing old write_int offset value to write so failing.