Clearing variables between entry elements (not doing it resulted in many additional and wrong cross references).