fixed bug with overwriting data