Fixing the error in the view functions