partial fix for pr 518

The tests still fail, but it is unrelated to how they are runned. It just doesn't found your email...

edit: heum, not sure what happened here with the PR I sent... Anyway, just cherry pick the last one.