[Meta Micro-opt] Manually applied small fixes brought by lioncash's pull request #335