bug fix for remove directory