Fix for #92 and #113