Fix getAllContacts when an error occurs