Fixes for issues #25 and #30