added another count function and fixed a bug in count_interface