possible fix for bug where event handlers are attached before DOM is ready + more