fixed the run() function