Bug fixes to span allocation.