Fixing signed/unsigned mismatch errors