modified for compile in mac