Fix compilation and warnings