fixed a bug in gpu version