add check that pub.y != res.y