Fix compiler warnings due to comparison of signed and unsigned