Fix for #17 and #11