fix packages warnings and circumstantial segfault

Change-Id: I0ff9ce1ae191a804df8127b9b163db3f2abd579c