fix #3714: NPE in deleteDirectory()