restore original code and adapt test #364