more corrections to beta reduction code