Added locking support and vpath calculation fixes