fixed issues with USE_CUDA flag