Fixed error handling of program execution