fix spin lock bugs