Speedometer will only go up to 40mph, and idea how to fix?

ALso....if you can screw the treads on it is likely in there far enough to engage and register....if it is showing 40 then it is spinnin.....and unless your needle is bouncing up to 40 then back to zero chances are your connection is OK