Fixing threading and memory heap errors.