Fixed registration of functions inside an array of handlers.

When an array of handler functions is registered, the function is not wrapped within an object. This will lead to issues when deregistering the functions.