bug fixes related to count update upon deletion