Index: libcfa/src/bits/containers.hfa
===================================================================
--- libcfa/src/bits/containers.hfa	(revision 8a13c47a8bd5040991c1059acf6c66c729253ebf)
+++ libcfa/src/bits/containers.hfa	(revision 3381ed7a703d0c964d6e94bffab7c58f0cdf0d17)
@@ -146,24 +146,31 @@
 	static inline forall( dtype T | is_node(T) ) {
 		void ?{}( __queue(T) & this ) with( this ) {
-			head{ 0p };
+			head{ 1p };
 			tail{ &head };
+			verify(*tail == 1p);
 		}
 
 		void append( __queue(T) & this, T * val ) with( this ) {
 			verify(tail != 0p);
+			verify(*tail == 1p);
 			*tail = val;
 			tail = &get_next( *val );
+			*tail = 1p;
 		}
 
 		T * pop_head( __queue(T) & this ) {
+			verify(*this.tail == 1p);
 			T * head = this.head;
-			if( head ) {
+			if( head != 1p ) {
 				this.head = get_next( *head );
-				if( !get_next( *head ) ) {
+				if( get_next( *head ) == 1p ) {
 					this.tail = &this.head;
 				}
 				get_next( *head ) = 0p;
-			}
-			return head;
+				verify(*this.tail == 1p);
+				return head;
+			}
+			verify(*this.tail == 1p);
+			return 0p;
 		}
 
@@ -180,6 +187,6 @@
 			get_next( *val ) = 0p;
 
-			verify( (head == 0p) == (&head == tail) );
-			verify( *tail == 0p );
+			verify( (head == 1p) == (&head == tail) );
+			verify( *tail == 1p );
 			return val;
 		}
Index: libcfa/src/bits/locks.hfa
===================================================================
--- libcfa/src/bits/locks.hfa	(revision 8a13c47a8bd5040991c1059acf6c66c729253ebf)
+++ libcfa/src/bits/locks.hfa	(revision 3381ed7a703d0c964d6e94bffab7c58f0cdf0d17)
@@ -60,6 +60,4 @@
 	}
 
-	extern void yield( unsigned int );
-
 	static inline void ?{}( __spinlock_t & this ) {
 		this.lock = 0;
@@ -68,8 +66,10 @@
 	// Lock the spinlock, return false if already acquired
 	static inline bool try_lock  ( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
+		disable_interrupts();
 		bool result = (this.lock == 0) && (__atomic_test_and_set( &this.lock, __ATOMIC_ACQUIRE ) == 0);
 		if( result ) {
-			disable_interrupts();
 			__cfaabi_dbg_record( this, caller );
+		} else {
+			enable_interrupts_noPoll();
 		}
 		return result;
@@ -83,4 +83,5 @@
 		#endif
 
+		disable_interrupts();
 		for ( unsigned int i = 1;; i += 1 ) {
 			if ( (this.lock == 0) && (__atomic_test_and_set( &this.lock, __ATOMIC_ACQUIRE ) == 0) ) break;
@@ -98,11 +99,10 @@
 			#endif
 		}
-		disable_interrupts();
 		__cfaabi_dbg_record( this, caller );
 	}
 
 	static inline void unlock( __spinlock_t & this ) {
+		__atomic_clear( &this.lock, __ATOMIC_RELEASE );
 		enable_interrupts_noPoll();
-		__atomic_clear( &this.lock, __ATOMIC_RELEASE );
 	}
 
