Fix a bug where selected line would be stored as row location and when
the order change, it would mess everything up