fix lookup function