fix apicontext initilization
working copy