Fixing "Thread was being aborted." error.