Created two issues #1 and #2. In the meantime this fix will handle the bugs so that the code runs in the expected way.