more optimizations to v1.4 branch