Added some hacks to make the script run on XE systems