Fix the registerScript to make it safe to use in a cluster