Added an option to stop on errors