fix cube script not to write to pipe if its not there