fixed problems with compatibility with Shan Chen and old CUDA (no printf or errexit)