Upgrade and fix tests