[build][bugs] fix functions rewriting