create generic context only when it is needed