Cleared DOM listener after each request and added a error handler