added beforeScript