Recompile when mode changes