Merging fixes from @mike-grayhat closes #337