reset context before makecontext call
replace 1 with EXIT_FAILURE in all err calls