Fix nested ranges