Fix for issues #36 and #37