Fix build errors using gcc