fixed bug with overwriting