Fix some replace issues