Upgrade scala version. Fix a type error