Fix bugs from merge and move positions into a local scope.