Fix build and remove warnings