fixed prepare script patch handling