Removed unused variable $dir

As far as i can see the variable $dir is not used and can be deleted.
Merge pull request #2028 from zimmi1/patch-6

Removed unused variable $dir