r3806 reviewed with the author of the script to make it working again