Update tests, fix infinite loop in crypto/keylookup