Bugfixes in CUDA backend

- Fixes #24 
- Fixes #46 
- Fixes #67