Fixed Bugs related to deleting