Removed unused variable $dir

As far as i can see the variable $dir is not used and can be deleted.