That was the main issue with the logic: looks like not all move records has corresponding record/morphRecord. Moving it below fixed matching edge records