fixed some error cases in periodUntil