Fixing segment bug