improved listener handling