fix sample table writing bug