terminate flag, check empty,