Fixed logic on moving flag