Fixed SQL exception issue when getting deleted activities