Port old fixes
Final fixes. Kinda works in CC now.