Fixed bug in directory deletion

No longer crash when we are in the directory