fixes for #14 and #145