After King Ferdinand died, who remained under Spanish rule?