fix some prepare script bugs

Change-Id: I2e1d20d2b96d9440b28ff03638251b6b284aeed9
Merge "fix some prepare script bugs"