Fix occasionally failing test