Added guard clause for unlisten.