Tweaked code to remove warning when compiling in Delphi XE 4