safer file loading