fix funtion on view and logintest