made small changes that let it compile in gcc