Fix a crash

The range is calculated completely wrong for centering a line
Fix centering content