fixes for issues #791 and #918