Index: kernel/arch/amd64/include/atomic.h
===================================================================
--- kernel/arch/amd64/include/atomic.h	(revision 95c47767f9669a11d10f6b7cb3e1ceca40b9788b)
+++ kernel/arch/amd64/include/atomic.h	(revision af56e9b85fca4f965e273d0cf0e72f55bb39d07b)
@@ -101,10 +101,9 @@
 static inline atomic_count_t test_and_set(atomic_t *val)
 {
-	atomic_count_t v;
+	atomic_count_t v = 1;
 	
 	asm volatile (
-		"movq $1, %[v]\n"
 		"xchgq %[v], %[count]\n"
-		: [v] "=r" (v),
+		: [v] "+r" (v),
 		  [count] "+m" (val->count)
 	);
Index: kernel/arch/ia32/include/atomic.h
===================================================================
--- kernel/arch/ia32/include/atomic.h	(revision 95c47767f9669a11d10f6b7cb3e1ceca40b9788b)
+++ kernel/arch/ia32/include/atomic.h	(revision af56e9b85fca4f965e273d0cf0e72f55bb39d07b)
@@ -101,10 +101,9 @@
 static inline atomic_count_t test_and_set(atomic_t *val)
 {
-	atomic_count_t v;
+	atomic_count_t v = 1;
 	
 	asm volatile (
-		"movl $1, %[v]\n"
 		"xchgl %[v], %[count]\n"
-		: [v] "=r" (v),
+		: [v] "+r" (v),
 		  [count] "+m" (val->count)
 	);
Index: kernel/generic/src/mm/as.c
===================================================================
--- kernel/generic/src/mm/as.c	(revision 95c47767f9669a11d10f6b7cb3e1ceca40b9788b)
+++ kernel/generic/src/mm/as.c	(revision af56e9b85fca4f965e273d0cf0e72f55bb39d07b)
@@ -952,9 +952,10 @@
 	if (!THREAD)
 		return AS_PF_FAULT;
-		
-	ASSERT(AS);
-
+	
+	if (!AS)
+		return AS_PF_FAULT;
+	
 	mutex_lock(&AS->lock);
-	area = find_area_and_lock(AS, page);	
+	area = find_area_and_lock(AS, page);
 	if (!area) {
 		/*
Index: kernel/generic/src/proc/scheduler.c
===================================================================
--- kernel/generic/src/proc/scheduler.c	(revision 95c47767f9669a11d10f6b7cb3e1ceca40b9788b)
+++ kernel/generic/src/proc/scheduler.c	(revision af56e9b85fca4f965e273d0cf0e72f55bb39d07b)
@@ -201,5 +201,4 @@
 		 * even though there is a runnable thread.
 		 */
-
 		 cpu_sleep();
 		 goto loop;
