inv key bug fix & define bug fix