Fix build errors related to volatile