add beforeCount()