make run on CPU

These are two changes that were causing the code to crash for me when running on CPUs.