Fix for issue #114 and #124.