Fix bugs in captureUntil and call it until