implement extract for structs and other fixes