Fixed the script to be running only on the master node