Fixed the remote timeout by re-ordering the calls to the SQL server