Write state tests fixes #7