Fixed bug in GPU code. Now GPU version seems to work fine