Defects, vortices, and critical current in Josephson-junction arrays.