Fix a compile failure and crashes on machines with 8GB RAM