Fixed a integer type mismatch (replaced the code with iterators anyway).