replace a somewhat buggy byte compare function with a slow but reliable one.