Fix duplicate call of 't.end()' in tests