Merge fix based on #924 discussions

This is a re-fix based on suggested master changes according to discussion at #924.