Added termination on err