now it stops properly