not working: base dir not restored
Fixed bug in libstruct base_dir