works on clang-3.4, fix counted_view problem with integer overflow