Check all Callouts function pointers for NULL before using them.
Don't load USER dll if not needed by the application.

diff --git a/scheduler/thread.c b/scheduler/thread.c
index 9647432..4b0f128 100644
--- a/scheduler/thread.c
+++ b/scheduler/thread.c
@@ -374,7 +374,7 @@
     else
     {
         MODULE_DllThreadDetach( NULL );
-        if (!(NtCurrentTeb()->tibflags & TEBF_WIN32)) TASK_KillTask( 0 );
+        if (!(NtCurrentTeb()->tibflags & TEBF_WIN32)) TASK_ExitTask();
         SYSDEPS_ExitThread( code );
     }
 }