Fix maintain_migrate validation issues v2

I decided that I was branching too much and my manual copying of @murrown's pull request into my code wasn't quite right, so I just made a new branch and did a real merge of said pull request.

Sorry about that.

(Replaces #48. See that pull request for most of the important comments.)