Fix onError handler for Delphi 7