test write to file, read from file