Fixed issue with dom changes breaking event listeners