What code was on your lines 540-559? I use Notepad++ and these lines are not the right place as I see it. I put your code inside the FEC supplied create_account.php replacing the following code:
PHP Code:
 // FEC MODIFICATION
      
$_SESSION['sendto'] = $_SESSION['cart_address_id'] = (int)$address_id;
    }
    
$_SESSION['shipping'] = ''
But I get the:
1062 Duplicate entry '1085' for key 'PRIMARY'
in:
[insert into zen_customers_info (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created, customers_info_source_id) values ('1085', '0', now(), '0')]

Where did I go wrong?