Adjust scripts to #1012, fixes #1021, cleanup