Fix import of StringIO
Fix metaclass creation