Added safeguard for run function