Fixed issue with IsEnd to end