Fixed missing import, deprecated CP functions, misnamed ivar