fix up some global corruptions, added refresh flags
remove debug