Actually fixed the invalid entity/client issue
Was due to a for loop using the wrong variable