fixed error in listener that was causing incorrect messages to be
displayed to user