Fix delete_tree endpoint

The endpoint stopped working due to a regression. This fixes it.