fixed the regexp checker for opts.ready. also added cleanup of event listeners