fix issue of rect becomes undefined after metadata was collapsed