more optimizations to v1.3 branch