Added various codes to clean up static object instances