Fix compilation with optimizations enabled