fixing to compile bagel on Mac OS10.9, in which ::to_lower and ::to_upper are not defined.