fixed a problem with opening too many files