Fix createcontext method