fixed compilation without threads and fixed some warnings