this should be checked before building the key