fixes wrong cmp
fixes a splint warning