moved it to controller
fixed the error