Fix scoping issue in frontend