fix delegateable deletion

While trying to fix #784 I stumbled across some strange things. I think I fixed most of it but I am really not sure if I got it right.