Fix #1471, replace getItemCount with removeItem in some places