abort when fopen() returned NULL
fix tiny bugs