Fix to check the correct entity