Update some dependencies to newer versions

Update some of the dependencies to new versions, fixing code where necessary.