diff --git a/configure.ac b/configure.ac
index 08930b81c40d78f6f3b66b11f75242afe2a5b4df..8d1defbb5b7f001274a14ca2e9052b31ba2e2275 100644
--- a/configure.ac
+++ b/configure.ac
@@ -99,22 +99,23 @@ if test "$enable_san" = "yes"; then
    fi
 fi
 
+
+# Autoconf stuff
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_HEADER_STDC
+
 AC_ARG_ENABLE([task-timers],
    [AS_HELP_STRING([--enable-task-timers],
-      [Enables task timer output and collection of extra data to enable it])].
-    [enable_tts]="$enableval$"],
-    [enable_tts]="no"]
+      [Enables task timer output and collection of extra data to enable it])],
+    [enable_tts="$enableval"],
+    [enable_tts="no"]
 )
 
 if test "$enable_tts" = "yes"; then
   AC_DEFINE(WITH_TASK_TIMERS,1,[Define if Task Timer recording is enabled])
 fi
 
-# Autoconf stuff
-AC_PROG_INSTALL
-AC_PROG_MAKE_SET
-AC_HEADER_STDC
-
 # Check for pthreads.
 AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
     CC="$PTHREAD_CC" LDFLAGS="$LDFLAGS $PTHREAD_LIBS $LIBS"]
diff --git a/src/qsched.c b/src/qsched.c
index b21a8306d5593590060e129f827a31d213055bba..86900ad7ea76753e27ee3ad45e0b8caea5043017 100644
--- a/src/qsched.c
+++ b/src/qsched.c
@@ -609,7 +609,7 @@ void qsched_done ( struct qsched *s , struct task *t ) {
     /* Set the task stats. */
     t->toc = getticks();
     #ifdef WITH_TASK_TIMERS
-    t->tid = qsched_get_tid();
+    t->tid = omp_get_thread_num();
     #endif
     if (!(s->flags & qsched_flag_norecost))
         t->cost = t->toc - t->tic;
@@ -1658,11 +1658,11 @@ FILE *task_file;
 
 task_file = fopen(filename, "w");
 
-for(int i = 0; i < s->nr_tasks; i++)
+for(int i = 0; i < s->count; i++)
 {
-    struct task *t = s->tasks[i];
+    struct task *t = &s->tasks[i];
     
-    fprintf("%i %i %lli %lli\n", t->type, t->tid, t->tic, t->toc);
+    fprintf(task_file,"%i %i %lli %lli\n", t->type, t->tid, t->tic, t->toc);
 
 }