ransac: add some error checking