fixed broken purepython code