Don't write messages twice

This fixes #4.