Made lua calls in protected mode and made entity queries instant instant of the next frame.