Fixes for #146, #136, #135