with this code ``$function`` is not guaranteed to be an array with a ``0`` index anymore, while it is expected by the line 115