added integrity checks