Fixes for #2 and #14