check for count>0 and remove index