bugfixes related with the source generation for reverse mode 2 with loops