improved typechecking in lambda