Fixed replace bug in app_controllers