Fixed bugs for cell selection edge cases.