Fixed some bugs with node deletion

Closes #136