newer version of prepare script