Called when the listener is created