Replace document instead of appending. fixes #79