Adding fixes for (but not yet completed) issue #82