read file only when needed