layer context creation fix