Fixed argument to threads and compiler warnings