fix a bug about open file handles.