Fixes for #22 and #24