Added extra scene synchronisation code to make scene thread-safe.