patch to fix variable err