Fix 'keepstate' issue