AMENDED AND RESTATED LOAN AND SECURITY AGREEMENT dated as of August 12, 1997