Bug appears fixed. Problem was not substituting vars in let expressions