Fix build and remove some warnings