Fix rightmost/leftmost.