fix signed/unsigned comparison warning
fix linker error by reordering link libraries