fix infinity and lambdas

self-merge cc @byels @confucious