Replace ui pointers by objects.