moved checking of lua in PATH before new symbolic link resolving to avoid infinite looping with readlink: missing operand