Fixed some NaN issues with sphere sampling.  Optimization deperately
needed at this point