Several small fixes and fix for #67