fixes for issue #30 and #31