fix bug: use overwriting instead of appending