fix missing $filename variable