fixed `count` functionality, added `count` test