updated old gamelib code to M4