Fix pointer-sign warnings, and add missing returns