Fix issues leaving the end.