Fixed a couple of bugs related to deluge