Improved error handling in package library.