Fix some replace-related bugs. Add "jal" replace inlining, not activated.