Added an extra protection against calling the listen function twice