add srand(time(0))
fix bad lock/unlock in lockForReading
fix use of unitialized value (valgrind)
add some mutexes