bugfix in count_bytes