Fix logic in prefbasedshard creation after restart