Compile warnings again

This fixes some of the remaining compile warnings after @xhaggi  's PR.
cast idx to size_t