pass filename instead of file object.