fixes for #182 and #41