move n into local context to fix warning