Fixed spinlock bug