Fix some error handling cases.
Move makecontext into function with getcontext for consistency
Remove superfluous getcontext()