updating guard function