maybe some improvement on MemoryErrors (but may introduce other
problems)