Fixes for #122, #121, #120, #118, #115, #113