Fix undefined object on deleted models