Corrected the _cuda_check_errors function with Axel's help.