made CPU version equal to GPU
a few bug fixes