fix cases file opening procedure