fixed bug recently introduced in spinlock
added lock correctness test