[build] fix function rewriting