Bug correction: the function didn't work with upvalues (thanks to Philipp Janda).
ompatibility improvement, despite not being used.