avoid memory leak from read_open