Fix sliding logic