make unit tests more robust

This should fix #748