Patches for #236 and close