some fixes for opening files