added code for compatibility delphi xe3

This code is part of me and part of other authors