fix bug on validation. use instance variable instead of local in controller.