Okay, the problem was mainly because due to some odd reason i had contours so small that the hull was merely a straight line (meaning consisting only of 2 points). So the error was referencing to the size of the hull vector, other than in the other posts where it seemed to have something to do with the type of vector.
So, just replacing
if(contours[i].size() > 3 )
with
if(hulls[i].size() > 2 )
works fine.