Fix a data overwritten bug

Fixes #12