Added try ... catch to handle listener failures