work on lookup key, fix some illegal state exceptions with hack