fix deadly bug from commit 99fed939127d212ede65e3725f04a5f710e3d77b