added code for compatibility delphi xe4