fixed undefined variable reference

$filename is undefined at this place
Merge pull request #24 from Burgov/patch-1

fixed undefined variable reference