fixing some locking and addind more comments to cfg file