cast internal_counter to expected type
Merge pull request #502 from prymitive/cast_fix

cast internal_counter to expected type