Various script fixes for phases. Probably broke many scripts. Need to test.