Fixed bug where script does not update interal on/off status