Issue1172 fix

These two fixes should fix all the problems from issue 1172 reported thus far.  I'm not in a position to test these currently.