Fixed (#841)

This is a fix for #841 and supporting test.
@adamralph i've got no clue on how to do that...

@filipw i agree, guess that's a flip-side of using xUnit...