Fixes #373, make sure appDir and dir are not set to same directory