When jails must be mental clinics