Make packagelock more resilient to faulty input