Minor fix

+ Fixed the add attribute code to make it more safe
TODO: Could add some logging to see the errors with package_name