Fixed crashing when sound is created inside a Lua thread.