fixed linking to use filename variable