Core/BG: prevent possible overflow + clean