fixed baseDir and allowing custom directoies

This fixes the error produced with baseDir and also allows the user to set a custom directory