Fix sticking problem when almost out of bound