more optimizations on eval.c