fixing the removeDir function
updated version in examples