Function context_init is added and bugs are fixed.