improved package error handling