Fixed possible issue with script event lists being indexed out of range if an event was unregistered during the invocation of another script event.