My fix for #120 and #220