First wave of bugfixes for the last commit.