added count_instances back

BECAUSE SOMEONE DELETED IT