Context manager patch