check filename only once