fixed imp lambda substitution and added type def substitution