bug fix for delete sub