Last two cherry-picks

As agreed, we will proceed with fixes for 1.2 by pull requests to cclib/v1.2, and then merge those fixes into master. That appears to be easier than cherry picking single commits. Here are two last commits from master that should be included in the next release.