Fixed last flag issue