added check for keys returned by engine