Corrected bug on listener creation