Fix the 'removeListener' method

This fix uses 'array_search' and 'array_splice' to actually find and remove a given handler from the listeners. This is necessary, because the previously used method 'array_diff' doesn't work with objects.