more fixes

Some more work on top of your fix. I think this resolves the spurious xpass. Please review and consider adding to your branch for the pull request against dev.