Workaround for CUDA bug

This is the workaround for #719.