Fix bug with decelaration if last dx = 0