rewrite rm_r using stat(), fixes #9