fix bug in let scoping resulting in unneccesary replacement - closes #193, closes #185