Fixes for #1043
Better fix for #1036
Fix for #1044 #1047
Fix regression with streaming