Fix wrong file size.
Fix pthread_cond_destroy() deadlock.