updated so that it gets the parent correctly