fix the bug found by the 10000-times test :)