clean up runInContext(); add error and leakage tests