Added some improvements due locking in multithreading environments