Bug fixes in run method