fix ZTS build and some warnings