fix several Delphi 5 compilation issues