Fix fingerprint construction and comparison bugs