Fix for #128, #126, #122