Guard against wrong types.