Fix handling of changed/deleted directories (fixes #231)