Fixed problems where a spinlock wasn't always released