added check to prevent hook execution on front-end