fixed static variable problems