Fixed issue with reference counting in static foute