more test code
added read/write tests for consistency