fixes on empty related models throwing an "object not found" error