added condition to prevent direct script access.