Fix to reduce memory usage and others.