fix fopen
several fix