fixed error in logging
added count method