working, fixed dependent destroy bug