 			output[i+j] = m_get(output_chunk,j,0)/128;
 		}
 
-		device_tmp_state = device_state_read;
+		device_state_tmp = device_state_read;
 		device_state_read = device_state_write;
-		device_state_write = device_tmp_state;
+		device_state_write = device_state_tmp;
 
 		device_tmp_output_chunk = device_output_chunk_read;
 		device_output_chunk_read = device_output_chunk_write;

	dim3 dimBlockA(1, 1);
	dim3 dimGridA(state.cols / dimBlockA.x, MatrixAp.rows / dimBlockA.y);
#else
	Matrix tmp_state;
#endif

	for(i = 0; i < samples;) {

		for(j = 0; j < blocksize; j++) {
			output[i+j] = m_get(output_chunk,j,0)/128;
		}
		state_tmp = m_multiplyblockdiag(MatrixAp,state,2);
		m_free(state);
		state = state_tmp;
#endif

		i = i + blocksize;
