Code fixes to compile in Delphi 6