test_fwrite: checking elements, fixed reading