make sure $file is not null