Fixed bug affecting the listen method