further optimization and conformity for string.format and printf