Fix NilClass error while listing pets