fixing table lookup bug