fix error handling in main profile

the all_errors variable was used out of the controllers scope